package com.example.s01_helloworld.controller;


// SrpingMVC

// @Controller          方法返回值模型视图对象 ModelAnView

// @RestController      里面的内容直接输出，不提供视图
//      等共同于 @Controller + @ResponeBody

import com.example.s01_helloworld.model.WebInfo;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Setter
public class HelloController {


    // RequestMapping 配置请求的路径
    @RequestMapping("/hello")
    public String hello()
    {
        return "Hello world";
    }


    @Autowired
    private WebInfo webInfo;

    @RequestMapping("/showInfo")
    public String showInfo()
    {
        return "网站信息:"+webInfo.getName()+webInfo.getTitle();
    }
}